//
//  HTAddToWishListView.swift
//  MagaCore
//
//  Created by 罗林轩 on 2024/8/28.
//  Copyright © 2024 HT. All rights reserved.
//

import SwiftUI

struct HTAddToWishListButton: View {
    /** 是否添加到收藏列表*/
    @State var isAddTowishList : Bool = false
    
    var body: some View {
        HStack {
            Image(isAddTowishList ? "Union" : "add")
                .resizable()
                .frame(width: 12,height: 12)
                .padding(.leading,12)
                .padding(.top,5)
                .padding(.bottom,5)
            Text("Add To My Watchlist")
                .ht_commonTextStyle(color: Color(hex: "#ff6c3c"), fontSize: 14, weight: .bold)
            Spacer()
            Divider()
                .padding(.leading,5)
                .frame(width: 1,height: 15)
                .background(Color(hex: "#ff6c3c"))
        }
        .onTapGesture {
            isAddTowishList = !isAddTowishList
            NotificationCenter.default.post(name: HTConfig.STATIC_notification_addToWishListAlert, object: nil, userInfo: ["isAddTowishList": isAddTowishList])
        }
        .background(LinearGradient(gradient: Gradient(colors: [Color(hex: "#ff6c3c",alpha: 0.5),Color(hex: "#ff6c3c",alpha: 0)]), startPoint: .leading, endPoint: .trailing))
        .cornerRadius(12.5, corners:.topLeft )
        .cornerRadius(12.5, corners:.bottomLeft )
    }
}
